<?php
/**
 * Created by PhpStorm.
 * User: 29620
 * Date: 2021/10/29
 * Time: 16:13
 */
namespace app\admin\validate;
use think\Validate;

class Brand extends Validate
{
    protected $rule = [
        'recommended' => 'in:0,1',
        'if_show' => 'in:0,1',
        'brand_logo' => 'array|fileExt:jpg,png,jpeg,gif|file',

        'brand_name' => 'require|chsAlphaNum',
        'tag' => 'require|chsAlphaNum',
    ];

    protected $message = [
        'if_show.in' => '必须在0,1中选择',
        'brand_name.require' => '必须输入商品名称',
        'brand_name.chsAlphaNum' => '商品名只能是中文、数字、字母',
        'brand_logo.fileExt' => '文件后缀名只能是jpg,png,jpeg,gif后缀',
        'tag.require' => '必须输入标签名称',
        'tag.chsAlphaNum' => '标签名只能是中文、数字、字母',
        'brand_logo.file' => '非图片不能上传'
    ];

    protected $scene = [
        'select' => ['recommended','if_show','brand_logo'],
        'add' => ['brand_name','sort_order','tag','brand_logo'],
        'edit' => ['brand_name','sort_order','tag','brand_logo']
    ];

}



